<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        //XmlHttpRequest对象
        function createXmlHttpRequest(){
            if(window.ActiveXObject){ //如果是IE浏览器
                return new ActiveXObject("Microsoft.XMLHTTP");
            }else if(window.XMLHttpRequest){ //非IE浏览器
                return new XMLHttpRequest();
            }
        }

        var xmlHttpRequest;
        //回调函数
        function readyCallback() {
            if (xmlHttpRequest.readyState == 4 /*&& xmlHttpRequest.status == 200*/) {
                console.log(xmlHttpRequest.response);
                document.body.append(xmlHttpRequest.response)
            }

        }
        window.onload = function(){
            // alert("hello world!");
            var url = "http://127.0.0.1:38001/datahaven-datamap/test/hello";
            xmlHttpRequest = createXmlHttpRequest();
            //2.设置回调函数
            xmlHttpRequest.onreadystatechange = readyCallback;

            //3.初始化XMLHttpRequest组建
            xmlHttpRequest.open("GET",url,true);
            // xmlHttpRequest.setRequestHeader("Authorization","eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1Njc0OTU2NTAsInVzZXJuYW1lIjoieGlhb21pbmcifQ.sgQxmrZH7g-lpsAmnsRZ_JTktPL1ewvDUtlkAHTYPSQ");
            //4.发送请求
            var requestBody = new FormData();
            requestBody.append("appCode", "string");
            requestBody.append("appDesc", "string");
            requestBody.append("appId", 0);
            requestBody.append("appName", "string");
            requestBody.append("createDate", "2019-09-03T03:17:39.918Z");
            requestBody.append("creator", 0);
            requestBody.append("dataState", "string");
            requestBody.append("modifier", 0);
            requestBody.append("modifyDate", "2019-09-03T03:17:39.918Z");
            xmlHttpRequest.send(requestBody);
        };
    </script>
</head>
<body>
</body>
</html>